package it.unibo.mycruise.boat;
import it.unibo.convoycruisecontrol.boatsubsystem.AbstractCommandBoat;
import it.unibo.convoycruisecontrol.boatsubsystem.AbstractStatusBoat;
import it.unibo.convoycruisecontrol.boatsubsystem.IBoatFactory;
import it.unibo.convoycruisecontrol.boatsubsystem.IDashboard;
import it.unibo.convoycruisecontrol.boatsubsystem.INavigationInfo;
import it.unibo.location.LocationDevice;

/**
 * @author ale
 * @version 1.0
 * @created 24-ott-2012 00:48:19
 */
public class BoatFactory implements IBoatFactory {

	public AbstractCommandBoat createBoat(LocationDevice locDev, int seqNum){
		AbstractCommandBoat commandBoat = null;
		try
		{
			NavigationInfo info = (NavigationInfo)createNavigationInfo(seqNum);
			locDev.addLocationListener(info);
			commandBoat = new CommandBoat(info,createStatusBoat(seqNum));
		}
		catch (Exception e) 
		{
			e.printStackTrace();
		}

		return commandBoat;
	}

	public IDashboard createDashboard(){
		return new Dashboard();
	}

	protected AbstractStatusBoat createStatusBoat(int seqNum){
		return new StatusBoat(seqNum);
	}

	protected INavigationInfo createNavigationInfo(int seqNum){
		return new NavigationInfo(seqNum);
	}

}